package com.liner.handler.exception;

import com.liner.exception.ShopException;
import com.liner.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler(ShopException.class)
    public Result handlerException(Exception e){
        log.error("出现了异常！ {}",e);
        return Result.fail(e.getMessage());
    }

}
